package com.psy.counseling.controller;


import com.psy.counseling.entity.Schedule;
import com.psy.counseling.service.impl.ScheduleServiceImpl;
import com.psy.counseling.vo.DeleteVO;
import com.psy.counseling.vo.PageVO;
import com.psy.counseling.vo.ResultVo;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 梁学儒
 * @since 2022-05-31
 */
@RestController
@RequestMapping("/api/schedule")
public class ScheduleController {
    @Resource
    private ScheduleServiceImpl scheduleService;

    @PostMapping("/addSchedule")
    public ResultVo addSchedule(@RequestBody Schedule schedule) {
        return scheduleService.addSchedule(schedule);
    }

    @DeleteMapping("/deleteSchedule")
    public ResultVo addSchedule(@RequestBody DeleteVO deleteVO) {
        return scheduleService.deleteSchedule(deleteVO);
    }

    @GetMapping("/getSchedule")
    public ResultVo getSchedule(Schedule schedule, PageVO page) {
        return scheduleService.listSchedules(schedule,page);
    }

    @PostMapping("/updateSchedule")
    public ResultVo updateSchedule(@RequestBody Schedule schedule) {
        return scheduleService.updateSchedule(schedule);
    }
}

